import 'package:flutter_taotaoshipin/generated/json/base/json_convert_content.dart';
import 'package:flutter_taotaoshipin/model/user_drama_record_entity.dart';

UserDramaRecordEntity $UserDramaRecordEntityFromJson(
    Map<String, dynamic> json) {
  final UserDramaRecordEntity userDramaRecordEntity = UserDramaRecordEntity();
  final String? title = jsonConvert.convert<String>(json['title']);
  if (title != null) {
    userDramaRecordEntity.title = title;
  }
  final String? cover = jsonConvert.convert<String>(json['cover']);
  if (cover != null) {
    userDramaRecordEntity.cover = cover;
  }
  final int? mainId = jsonConvert.convert<int>(json['main_id']);
  if (mainId != null) {
    userDramaRecordEntity.mainId = mainId;
  }
  final int? sort = jsonConvert.convert<int>(json['sort']);
  if (sort != null) {
    userDramaRecordEntity.sort = sort;
  }
  final String? dramaName = jsonConvert.convert<String>(json['drama_name']);
  if (dramaName != null) {
    userDramaRecordEntity.dramaName = dramaName;
  }
  final int? dramaId = jsonConvert.convert<int>(json['drama_id']);
  if (dramaId != null) {
    userDramaRecordEntity.dramaId = dramaId;
  }
  final String? vid = jsonConvert.convert<String>(json['vid']);
  if (vid != null) {
    userDramaRecordEntity.vid = vid;
  }
  final int? ctime = jsonConvert.convert<int>(json['ctime']);
  if (ctime != null) {
    userDramaRecordEntity.ctime = ctime;
  }
  return userDramaRecordEntity;
}

Map<String, dynamic> $UserDramaRecordEntityToJson(
    UserDramaRecordEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['title'] = entity.title;
  data['cover'] = entity.cover;
  data['main_id'] = entity.mainId;
  data['sort'] = entity.sort;
  data['drama_name'] = entity.dramaName;
  data['drama_id'] = entity.dramaId;
  data['vid'] = entity.vid;
  data['ctime'] = entity.ctime;
  return data;
}

extension UserDramaRecordEntityExtension on UserDramaRecordEntity {
  UserDramaRecordEntity copyWith({
    String? title,
    String? cover,
    int? mainId,
    int? sort,
    String? dramaName,
    int? dramaId,
    String? vid,
    int? ctime,
  }) {
    return UserDramaRecordEntity()
      ..title = title ?? this.title
      ..cover = cover ?? this.cover
      ..mainId = mainId ?? this.mainId
      ..sort = sort ?? this.sort
      ..dramaName = dramaName ?? this.dramaName
      ..dramaId = dramaId ?? this.dramaId
      ..vid = vid ?? this.vid
      ..ctime = ctime ?? this.ctime;
  }
}